package com.dmtt;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@MapperScan(basePackages = "com.dmtt.web.mapper")
@EnableScheduling
@EnableAsync
public class DmttApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(DmttApplication.class, args);
    }

    //重写configure方法，否则在部署到tomcat时，接口将访问不到
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(DmttApplication.class);
    }
    @Bean
    public Queue orderQueue(){
        return new Queue("orderQueue",true);
    }
}
